package com.huawei.zyb.taskManager.application.task.dto;

import com.huawei.zyb.taskManager.domain.task.valueobject.TaskLevel;
import com.huawei.zyb.taskManager.domain.task.valueobject.TaskPriority;
import com.huawei.zyb.taskManager.domain.task.valueobject.TaskStatus;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import jakarta.validation.constraints.PositiveOrZero;
import jakarta.validation.constraints.Size;

/**
 * 创建任务命令
 */
public class CreateTaskCommand {
    
    @NotBlank(message = "任务标题不能为空")
    @Size(max = 200, message = "任务标题长度不能超过200个字符")
    private String title;
    
    @Size(max = 2000, message = "任务描述长度不能超过2000个字符")
    private String description;
    
    private TaskStatus status;
    
    @NotNull(message = "任务优先级不能为空")
    private TaskPriority priority;
    
    @NotNull(message = "任务层级不能为空")
    private TaskLevel level;
    
    @NotNull(message = "需求ID不能为空")
    @Positive(message = "需求ID必须为正数")
    private Long requirementId;
    
    private Long parentTaskId;
    
    private String assigneeId;
    
    @Positive(message = "预估工时必须为正数")
    private Double estimatedHours;
    
    private Integer progress;
    
    @PositiveOrZero(message = "实际工时必须为非负数")
    private Double actualHours;
    
    public CreateTaskCommand() {
    }
    
    public CreateTaskCommand(String title, String description, TaskPriority priority,
                           TaskLevel level, Long requirementId, Long parentTaskId,
                           String assigneeId, Double estimatedHours, Integer progress, Double actualHours) {
        this.title = title;
        this.description = description;
        this.priority = priority;
        this.level = level;
        this.requirementId = requirementId;
        this.parentTaskId = parentTaskId;
        this.assigneeId = assigneeId;
        this.estimatedHours = estimatedHours;
        this.progress = progress;
        this.actualHours = actualHours;
    }
    
    public CreateTaskCommand(String title, String description, TaskStatus status, TaskPriority priority,
                           TaskLevel level, Long requirementId, Long parentTaskId,
                           String assigneeId, Double estimatedHours, Integer progress, Double actualHours) {
        this.title = title;
        this.description = description;
        this.status = status;
        this.priority = priority;
        this.level = level;
        this.requirementId = requirementId;
        this.parentTaskId = parentTaskId;
        this.assigneeId = assigneeId;
        this.estimatedHours = estimatedHours;
        this.progress = progress;
        this.actualHours = actualHours;
    }
    
    public String getTitle() {
        return title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public TaskPriority getPriority() {
        return priority;
    }
    
    public void setPriority(TaskPriority priority) {
        this.priority = priority;
    }
    
    public TaskLevel getLevel() {
        return level;
    }
    
    public void setLevel(TaskLevel level) {
        this.level = level;
    }
    
    public Long getRequirementId() {
        return requirementId;
    }
    
    public void setRequirementId(Long requirementId) {
        this.requirementId = requirementId;
    }
    
    public Long getParentTaskId() {
        return parentTaskId;
    }
    
    public void setParentTaskId(Long parentTaskId) {
        this.parentTaskId = parentTaskId;
    }
    
    public String getAssigneeId() {
        return assigneeId;
    }
    
    public void setAssigneeId(String assigneeId) {
        this.assigneeId = assigneeId;
    }
    
    public Double getEstimatedHours() {
        return estimatedHours;
    }
    
    public void setEstimatedHours(Double estimatedHours) {
        this.estimatedHours = estimatedHours;
    }
    
    public Integer getProgress() {
        return progress;
    }
    
    public void setProgress(Integer progress) {
        this.progress = progress;
    }
    
    public Double getActualHours() {
        return actualHours;
    }
    
    public void setActualHours(Double actualHours) {
        this.actualHours = actualHours;
    }
    
    public TaskStatus getStatus() {
        return status;
    }
    
    public void setStatus(TaskStatus status) {
        this.status = status;
    }
    
    @Override
    public String toString() {
        return "CreateTaskCommand{" +
                "title='" + title + '\'' +
                ", description='" + description + '\'' +
                ", priority=" + priority +
                ", level=" + level +
                ", requirementId=" + requirementId +
                ", parentTaskId=" + parentTaskId +
                ", assigneeId='" + assigneeId + '\'' +
                ", estimatedHours=" + estimatedHours +
                ", progress=" + progress +
                ", actualHours=" + actualHours +
                '}';
    }
}